package org.openstreetmap.josm.plugins.cadastre_es;

public class GetMark extends Bresenham<Integer> {
	private int near = 0;
	private int wrong = 0;
	private int correct = 0;
	
	public GetMark(Pixel start, Pixel end) {
		super(start, end);
	}

	protected void run(Pixel p) {
		if (p.isFollowed())
			correct++;
		else if (p.top().isFollowed() || p.bottom().isFollowed() || p.right().isFollowed() || p.left().isFollowed())
			near++;
		else
			wrong++;
	}
	
	public Integer end() {
		return correct * 3 + near * 2 - wrong * 20;
	}
}